#! /bin/bash
baseline=("120" "125" "129")
dist=("ctl2" "ctl3" "ctl4" "oe2309" "oe2403")
username=
password=

echo "开始配置坚果云"
echo "创建远端目录.."

# 创建主目录
curl -u "${username}:${password}" -X MKCOL "https://dav.jianguoyun.com/dav/k8s-install-rpms"

# 创建子目录
for d in ${dist[@]}; do
    curl -u "${username}:${password}" -X MKCOL "https://dav.jianguoyun.com/dav/k8s-install-rpms/${d}"
    
    if [[ $d == "ctl2" || $d == "ctl3" ]]; then
        for b in ${baseline[@]}; do 
            curl -u "${username}:${password}" -X MKCOL "https://dav.jianguoyun.com/dav/k8s-install-rpms/${d}/${b}"
        done
    elif [ $d == "oe2309" ]; then
        curl -u "${username}:${password}" -X MKCOL "https://dav.jianguoyun.com/dav/k8s-install-rpms/${d}/125"
        curl -u "${username}:${password}" -X MKCOL "https://dav.jianguoyun.com/dav/k8s-install-rpms/${d}/129"
    else
        curl -u "${username}:${password}" -X MKCOL "https://dav.jianguoyun.com/dav/k8s-install-rpms/${d}/129"
    fi
done

echo "目录创建完成！"



